package shun.demo.loop;

import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.widget.Toast;

/**
 * Created by chen on 1/20/14.
 */
public class LoopThread extends Thread {

    Context mContext;

    public LoopThread(Context context) {
        mContext = context;
    }

    @Override
    public void run() {
        Looper.prepare();

        Handler handler = new Handler();

        handler.post(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(mContext, "message before loop", Toast.LENGTH_LONG).show();
            }
        });

        Looper.loop();
    }
}
